package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.ExpectInfo;
import cn.liyicun.cp.cpweb.entity.ExpectInfoExample;
import cn.liyicun.cp.cpweb.entity.ExpectInfoKey;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface ExpectInfoMapper extends Serializable {
    @SelectProvider(type=ExpectInfoSqlProvider.class, method="countByExample")
    long countByExample(ExpectInfoExample example);

    @DeleteProvider(type=ExpectInfoSqlProvider.class, method="deleteByExample")
    int deleteByExample(ExpectInfoExample example);

    @Delete({
        "delete from expect_info",
        "where code = #{code,jdbcType=VARCHAR}",
          "and expect = #{expect,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(ExpectInfoKey key);

    @Insert({
        "insert into expect_info (code, expect, ",
        "create_time, end_time, ",
        "open_code, open_time, ",
        "open_status, update_time)",
        "values (#{code,jdbcType=VARCHAR}, #{expect,jdbcType=BIGINT}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ",
        "#{openCode,jdbcType=VARCHAR}, #{openTime,jdbcType=TIMESTAMP}, ",
        "#{openStatus,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP})"
    })
    int insert(ExpectInfo record);

    @InsertProvider(type=ExpectInfoSqlProvider.class, method="insertSelective")
    int insertSelective(ExpectInfo record);

    @SelectProvider(type=ExpectInfoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="expect", property="expect", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="open_code", property="openCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="open_time", property="openTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="open_status", property="openStatus", jdbcType=JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ExpectInfo> selectByExampleWithRowbounds(ExpectInfoExample example, RowBounds rowBounds);

    @SelectProvider(type=ExpectInfoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="expect", property="expect", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="open_code", property="openCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="open_time", property="openTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="open_status", property="openStatus", jdbcType=JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ExpectInfo> selectByExample(ExpectInfoExample example);

    @Select({
        "select",
        "code, expect, create_time, end_time, open_code, open_time, open_status, update_time",
        "from expect_info",
        "where code = #{code,jdbcType=VARCHAR}",
          "and expect = #{expect,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="expect", property="expect", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="open_code", property="openCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="open_time", property="openTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="open_status", property="openStatus", jdbcType=JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    ExpectInfo selectByPrimaryKey(ExpectInfoKey key);

    @UpdateProvider(type=ExpectInfoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ExpectInfo record, @Param("example") ExpectInfoExample example);

    @UpdateProvider(type=ExpectInfoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ExpectInfo record, @Param("example") ExpectInfoExample example);

    @UpdateProvider(type=ExpectInfoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ExpectInfo record);

    @Update({
        "update expect_info",
        "set create_time = #{createTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "open_code = #{openCode,jdbcType=VARCHAR},",
          "open_time = #{openTime,jdbcType=TIMESTAMP},",
          "open_status = #{openStatus,jdbcType=INTEGER},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where code = #{code,jdbcType=VARCHAR}",
          "and expect = #{expect,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ExpectInfo record);
}